import { channels } from '@/api/index.js'
const state = {
  typeList: [],
  currentId: ''
}
const mutations = {
  setTypeList (state, value) {
    state.typeList = value
  },
  setCurrentId (state, value) {
    state.currentId = value
  }
}
const actions = {
  // 获取所有分类
  async getTypeList (store) {
    const res = await channels()
    store.commit('setTypeList', res.data.data.channels)
    store.commit('setCurrentId', res.data.data.channels[0].id)
    // 调用完成后调用详情
    // 调用其它模块的actions方法
    store.dispatch('list/getInfoList', res.data.data.channels[0].id, {
      root: true
    })
    console.log(res)
  }
}
const getters = {}
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
